package com.css.crm.utility;

import javax.faces.model.SelectItem;

public class SelectItemsUtil {

	/**
	 * get Month Selection 01--12
	 * 
	 * @return
	 */
	public static SelectItem[] getMonthItems() {
		SelectItem monthItems[] = new SelectItem[13];
		monthItems[0] = new SelectItem("", "");
		for (int i = 1; i <= 9; i++) {
			monthItems[i] = new SelectItem("0" + i, "0" + i);
		}
		monthItems[10] = new SelectItem("10", "10");
		monthItems[11] = new SelectItem("11", "11");
		monthItems[12] = new SelectItem("12", "12");
		return monthItems;
	}

	/**
	 * get Day Selection 01--31
	 * 
	 * @param month
	 * @return
	 */
	public static SelectItem[] getDayItems(int month) {
		int days = 1;
		switch (month) {
		case 1:
			days = 31;
			break;
		case 2:
			days = 29;
			break;
		case 3:
			days = 31;
			break;
		case 4:
			days = 30;
			break;
		case 5:
			days = 31;
			break;
		case 6:
			days = 30;
			break;
		case 7:
			days = 31;
			break;
		case 8:
			days = 31;
			break;
		case 9:
			days = 30;
			break;
		case 10:
			days = 31;
			break;
		case 11:
			days = 30;
			break;
		case 12:
			days = 31;
			break;
		default:
			days = 31;
			break;
		}

		SelectItem dayItems[] = new SelectItem[days + 1];
		dayItems[0] = new SelectItem("", "");
		for (int i = 1; i <= 9; i++) {
			dayItems[i] = new SelectItem("0" + i, "0" + i);
		}
		for (int i = 10; i <= days; i++) {
			dayItems[i] = new SelectItem("" + i, "" + i);
		}
		return dayItems;
	}

	/**
	 * get customer status items valid/cancelled
	 * 
	 * @return
	 */
	public static SelectItem[] getCustomerStatusItems() {
		SelectItem[] statusItems = new SelectItem[2];
		statusItems[0] = new SelectItem(ConstantUtil.CUSTOMER_STAT_CODE_V, ResourceUtil.getLabelString("label_customer_status_valid"));
		statusItems[1] = new SelectItem(ConstantUtil.CUSTOMER_STAT_CODE_C, ResourceUtil.getLabelString("label_customer_status_cancelled"));
		return statusItems;

	}

}
